package com.taotao.st3.service;

import com.taotao.st3.base.BusinessException;
import com.taotao.st3.dao.AreaMapper;
import com.taotao.st3.model.po.Area;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * <p>
 * 测试spring事务管理
 * </p>
 *
 * @author fanbeibei
 * @version V1.0
 * @since 2019/8/14 11:04
 */
@Service
public class AreaService2{
    @Resource
    private AreaMapper areaMapper;

    @Transactional(rollbackFor = Exception.class)
    public void addAreaRollBack0(Area area) throws BusinessException {
        areaMapper.save(area);
        throw new BusinessException("");

    }
    @Transactional(rollbackFor = Exception.class)
    public void addAreaRollBack1(Area area) throws BusinessException {
        areaMapper.save(area);
    }



}
